package com.company;

public class Test04正整数分解质因数 {
    public static boolean shushu(int x){
        for(int i = 2;i<Math.sqrt(x);i++){
            if(x%i==0)
            {
                return false;
            }
        }
        return true;
    }

    public static void main(String[] args) {
        int n = 345;
        for(int i=2;i<n;i++){
            if(!shushu(i)){
                continue;
            }
            while (n%i==0){
                System.out.println(i);
                n=n/i;
                if(n!=1){
                    System.out.println("*");
                }else {
                    break;
                }
            }
        }
        if (n!=1){
            System.out.println(n);
        }
    }
}
